<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>用户登录 - 华丽的YY吧 - 汇聚每日搞笑段子、热门图片、有趣新闻、直播热帖连载</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="keyword" content="有趣的,搞笑段子,直播热帖,连载,新鲜事儿,自媒体,互联网">
    <meta name="description" content="汇聚每日搞笑段子、热门图片、有趣新闻。它将微博、门户、社区、bbs、天涯、百度贴吧连载直播、豆瓣连载、社交网站等海量内容聚合在一起,通过用户推荐生成最热榜单。" />
    {load href="/static/layui/css/layui.css"/}
    {load href="/static/layui/layui.js"/}
    <link rel="stylesheet" type="text/css" href="/static/css/normalize.css">
    <link rel="stylesheet" type="text/css" href="/static/css/main.css">
    <link rel="stylesheet" type="text/css" href="/static/css/pygments.css">
    <link rel="stylesheet" type="text/css" href="/static/css/mobile.css">
    <link rel="stylesheet" type="text/css" href="/static/css/print.css">
    <link href='/static/css/css.css' rel='stylesheet' type='text/css'>

</head>



<body id="home-page-layout">
{include file='public/header'/}

<div id="page">

    <div id="intro-container">
        <div class="container">
            <div id="intro-wrapper">
                <div id="intro">
                    <h1>华丽的YY吧 是……</h1>

                    <p>源代码片段管理与分享网站，致力于搭建最大的云端代码库。云代码收录常用代码片段，方便程序员快速搜索源代码片段，提高代码重用性，提高开发速度。</p>

                    <a href="downloads/" class="download-link" title="下载 代码库">下载 代码库</a>
                    或
                    <a href="about/">了解更多……</a>
                </div>
                <div id="code"></div>
            </div>

        </div>
    </div>

    <div id="main-wrapper" class="container">
        <div id="main">
            <div id="content-wrapper">
                <h1>用户登录</h1>
                <div style="background:#FFFFFF;padding: 20px;border-radius: 4px;box-shadow: 4px 4px 4px #444444">
                    <div class="layui-form-item">
                        <label class="layui-form-label" style="padding:9px 8px;width: 100px">用户名：</label>
                        <div class="layui-input-block">
                            <input type="text" name="uname" id="uname" required  lay-verify="required" placeholder="请输入用户名" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label" style="padding:9px 8px;width: 100px">密码：</label>
                        <div class="layui-input-block">
                            <input type="password" name="pwd" id="pwd" required  lay-verify="required" placeholder="请输入密码" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label" style="padding:9px 17px;width: 109px">验证码：</label>
                        <div class="layui-input-inline">
                            <input type="text" name="captcha" id="captcha" required  lay-verify="required" placeholder="请输入验证码" autocomplete="off" class="layui-input" style="width: 150px" >
                        </div>
                        <img id="captchaimg" src="{:captcha_src()}" alt="captcha" onclick="this.src=this.src+'?'+Math.random()"/>
                    </div>

                    <div class="layui-form-item">
                        <div class="layui-input-block">
                            <button class="layui-btn" lay-submit lay-filter="formDemo" onclick="dologin()">立即提交</button>
                            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                            &nbsp; <a href="{:url('register')}">没有帐号？ </a>
                        </div>
                    </div>
                </div>
            </div>
            <hr class="hidden-modern" />

            <div id="sidebar-wrapper">
                <div id="sidebar">
                    <div class="navigation">
                        <h3><strong>试用</strong>，其实很简单！</h3>

                        <ul class="menu">
                            <li><a href="https://ruby.github.io/TryRuby/">在浏览器中试用 Ruby（英文）</a></li>


                            <li><a href="/zh_cn/documentation/quickstart/">20 分钟体验 Ruby</a></li>



                            <li><a href="/zh_cn/documentation/ruby-from-other-languages/">从其它语言转到 Ruby</a></li>

                        </ul>
                    </div>



                    <div class="navigation">
                        <h3><strong>探索</strong>新的世界</h3>
                        <ul class="menu">

                            <li><a href="/zh_cn/documentation/">文档</a></li>





                            <li><a href="https://rubybib.org/">学术研究</a></li>



                            <li><a href="/zh_cn/libraries/">代码库</a></li>



                            <li><a href="/zh_cn/documentation/success-stories/">成功案例</a></li>

                        </ul>
                    </div>



                    <div class="navigation">
                        <h3><strong>加入</strong>友善及日益壮大的社区</h3>
                        <ul>

                            <li><a href="/zh_cn/community/mailing-lists/">邮件列表</a>: 联系喜爱 Ruby 的朋友
                            </li>



                            <li><a href="/zh_cn/community/user-groups/">用户组</a>: 参与 Ruby 爱好者活动
                            </li>



                            <li><a href="/zh_cn/community/weblogs/">博客</a>: 阅读 Ruby 相关的博客
                            </li>



                            <li><a href="/zh_cn/community/ruby-core/">Ruby 核心</a>: 帮助开发 Ruby 语言
                            </li>



                            <li><a href="https://bugs.ruby-lang.org/">问题跟踪</a>: 报告或帮助解决 Ruby 的问题
                            </li>

                        </ul>
                    </div>






                    <h3>订阅</h3>
                    <p><a href="/zh_cn/feeds/news.rss">最新消息（RSS）</a></p>


                </div>
            </div>
            <hr class="hidden-modern" />

        </div>
    </div>
</div>

<div class="container">
    {include file='public/footer'/}
</div>


{load href="/static/js/jquery-1.10.2.min.js"/}
<script type="text/javascript">
    layui.use(['layer'],function(){
        $ = layui.jquery;
        layer = layui.layer;

        // 用户名控件获取焦点
        $('#uname').focus();
        // 回车登录
        $('input').keydown(function(e){
            if(e.keyCode == 13){
                dologin();
            }
        });
    });

    // 重新生成验证码
    function reloadImg(){
        $('#captchaimg').attr('src','{:captcha_src()}?rand='+Math.random());
    }

    function dologin() {

        var uname = $.trim($('#uname').val());
        var pwd = $.trim($('#pwd').val());
        var captcha = $.trim($('#captcha').val());

        if(uname == ''){
            layer.alert('请输入用户名',{icon:2});
            return false;
        }
        if(pwd == ''){
            layer.alert('请输入密码',{icon:2});
            return;
        }
        if(captcha==''){
            layer.alert('请输入验证码',{icon:2});
            return;
        }
        $.post("{:url('login')}",{'uname':uname,'pwd':pwd,'captcha':captcha},function(res){
            if(res.code==0){
                layer.msg(res.msg);
                setTimeout(function(){window.location.href = '/index.php/bm'},1000);
            }else{
                reloadImg();
                layer.alert(res.msg,{icon:2});
            }
        },'json');
    }

</script>
</body>
</html>
